<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <title>美业红</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1">
        <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
        <link href="/public/css/main.css" rel="stylesheet">
        <script type='text/javascript' src='/public/js/jquery-3.1.1.min.js'></script>
        <script type="text/javascript" src='/public/js/jquery.validate.js'></script>
        <script type="text/javascript" src='/public/js/main/main.js'></script>
        <script>
            var _hmt = _hmt || [];
            (function () {
                var hm = document.createElement("script");
                hm.src = "//hm.baidu.com/hm.js?8d43b5b5d798921b66d689f7a792e6e2";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script>
        <script type="text/javascript">
            document.domain = '<?php echo _DOMAIN_ALL_;?>';
        </script>
        <link rel="shortcut icon" type="image/ico" href="/favicon.ico">
    </head>
    <body style="background-color: #f4f4f4;">
        <div class="navigation">
            <div class='navlogo'>
            <a href='/'><img class='_navlogo' src="/public/images/logo.png"></a>
            </div>
            <div class='navson'>
                <ul class='fr'>
                <li><a href='/' class='anchor'><b>主页</b></a></li>
                <li><a href="/home/store" class='anchor'><b>店铺</b></a></li>
                <li><a href="/home/barber" class='anchor'><b>成员</b></a></li>
                <li><a href="/home/action" class='anchor'><b>活动</b></a></li>
                <li><a href="/home/order" class='anchor'><b>订单</b></a></li>
                <li><a href="/home/coupon" class='anchor'><b>优惠券</b></a></li>
                <li><a href="/home/goods" class='anchor'><b>商品</b></a></li>
                </ul>
           </div>
            <?php if($_SESSION['id']>0){?>
            <div style="float:right;padding-right:10%">你好:<span id='login_name'></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class='anchor' href='/home/passport/repassword'>修改密码</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class='anchor' href='/home/passport/logout'>退出</a></div>
            <?php }?>
        </div>
        <div style='margin-top:80px;width:100%'>
            <img class='_navlogo' src="/public/images/contentlogo.png" style='width:100%;height:100px'>
        </div>
        <div class='container'>
            <div class='_main'>
            <div class='_line'></div> 
<div>
    <div class='login_div'>
      <?php if($barber){?>
        <form  action='/home/barber/update' method="post">
      <?php }else{?>
        <form  action='/home/barber/submit' method="post" id='form'>
      <?php }?>
            <input type='hidden' name='id' value="<?php echo $barber['id']?>">
            <div class='form-group row'>
                <label for="exampleInputName2">所属门店:</label>
                <select name='store'>
                    <option>请选择门店</option>
                    <?php foreach($_store as $v){?>
                    <option value='<?php echo $v['id'];?>' <?php if($v['id']==$barber['store_id']){echo "selected='selected'";}?>><?php echo $v['name'];?></option>
                    <?php }?>
                </select>
            </div>
            <div class='form-group row'>
                <label for="exampleInputName2">姓名:</label>
                <input type="text" class="form-control" name='name' value="<?php if($barber){echo $barber['name'];}else{echo '';}?>" placeholder=""/>
            </div>
            <div class='form-group row'>
                <label for="exampleInputName2">性别:</label>
                <?php if(empty($barber) || $barber['sex']==0){?>
                    <input type="radio" name="sex" value="0" checked> 男
                    <input type="radio" name="sex" value="1"> 女 
                <?php }else{?>
                    <input type="radio" name="sex" value="0" > 男
                    <input type="radio" name="sex" value="1" checked> 女 
                <?php } ?>    
            </div>
            <div class='form-group row'>
                <label for="exampleInputName2">头像:</label>
                <?php if($barber['id']>0){?>
                <input type='hidden'  class="form-control" name='photo' id='photo' value="<?php echo $barber['photo'];?>">
                <div style="height: 30rem;width:30rem;margin:2rem auto">
                <img src="<?php echo $barber['photo'];?>" class="form-control" style="width:100%;height: 100%;border-radius:50%;overflow:hidden;" id="photo_img" alt=''/>
                </div>
                <?php }else{?>
                <div style="height: 30rem;width:30rem;margin:2rem auto">
                <input type='hidden'  class="form-control" name='photo' id='photo' value='/public/images/tou.png'>
                <img src="/public/images/tou.png" class="form-control" style="width:100%;height: 100%;border-radius:50%;overflow:hidden;" id="photo_img"/>
                </div>
                <?php }?>
                <iframe src="/home/barber/img" frameborder="no" border="0" scrolling='no' style="width:25rem;height: 4rem;padding-top: 1rem" ></iframe>
            </div>
            <div class='form-group row'>
                <label for="exampleInputName2">账号(发型师手机号):</label>
                <?php if(!empty($barber)){?>
                <input type="text" class="form-control" name='mobile' value="<?php if($barber){echo $barber['mobile'];}?>" disabled="disabled" />
                <?php }else{ ?>
                <input type="text" class="form-control" name='mobile' value=""  />
                <?php } ?>
            </div>
            <div class='form-group row'>
                <label for="exampleInputName2">级别:</label>
                <select name='level'>
                 <?php foreach($level as $v){ if($v['name']==$barber['level']){ echo "<option value='".$v['name']." 'selected = 'selected'>".$v['name']."</option>"; continue; } echo "<option value='".$v['name']."'>".$v['name']."</option>"; } ?>
                </select>
            </div>
            <div class="form-group login_sub">
            <?php if($barber){?>
                <input type="submit" class="btn btn-info" name="submit" value="确认修改">
             <?php }else{?>   
                <input type="submit" class="btn btn-info" name="submit" value="添加">
                <?php }?>
            </div>
        </form>
    </div>
</div>

<script type='text/javascript'>
    $(document).ready(function () {
        $("#form").validate({
            rules: {
                store:{
                    required: true,
                    min:1
                },
                name: {
                    required: true,
                },
                sex: {
                    required: true,
                },
                level: {
                    required: true,
                },
                mobile: {
                    required: true,
                    number: true,
                    mobile: true
                },
                
            },
            messages: {
                store:{
                    required: '请选择店铺',
                    min: '请选择店铺'
                },
                name: {
                    required: '请输入姓名',
                },
                sex: {
                    required: '请选择性别',
                },
                level: {
                    required: '请输入级别',
                },
                mobile: {
                    required: '请输入手机号',
                    number: '请输入手机号',
                    mobile: '请输入手机号'
                },
            }
        });
  jQuery.validator.addMethod("mobile", function (value, element) {
            var length = value.length;
            var mobile = /^(((1[1-9]{1}[0-9]{1})|(15[0-9]{1}))+\d{8})$/
            return this.optional(element) || (length == 11 && mobile.test(value));
        }, "手机号码格式错误");
    });
</script>
</div>
</div>
<div class='_line'></div>
<div class="newfooter">
         ©2015-2017 All Rights Reserved ( 京ICP备15010043号 ) 
</div>
<div id='mask_layer' style="text-align: center;width:100%;height:100%;overflow:hidden;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#8E8E8E',endColorstr='##8E8E8E');
    background-color:rgba(255, 255, 255, 0.4);position:fixed; _position:absolute; top:0;left:0; z-index:5000;display:none ">
    <div style="padding-top: 20%"><h1><b>loading<span id="_loading"></span></b></h1></div>
</div>
    </body>
</html>